#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
    FILE* fp=fopen("log.txt","w");
    if(fp==NULL)
    {
        perror("fopen");
        return 1;
    }
    const char* message="hello linux";
    int cnt=1;
    while(cnt<=10)
    {
       char buffer[1024];
       snprintf(buffer,sizeof(buffer),"%s%d\n",message,cnt++);
       fwrite(buffer,strlen(buffer),1,fp);
    }
    fclose(fp);
    return 0;
}
